package com.ln.dm1104.demo02;

import java.util.function.Consumer;

/**
 * @author Ln
 * @version 终极版
 * @date 2022/11/4 15:36
 */
public class Test01 {
    public static void main(String[] args) {
//        Consumer<int[]> consumer=arr->Test01.sum(arr);

        Consumer<int[]> consumer1=Test01::sum;
        int []arr={4,5,6,10};
        consumer1.accept(arr);
    }

    public static void sum(int[] arr){
        int a=0;
        for (int b :arr){
            a+=b;
        }
        System.out.println("数组中元素的和:"+a);
    }
}
